/*!
\file Node.cpp
\brief Contains implementation of Node class.
\ingroup Graph
*/

#include"Node.h"


Node::Node( int identifier ){
	m_label = "";
	m_id = identifier;
}

Node::Node( QString label, int identifier ){
	m_label = label;
	m_id = identifier;
}

Node::Node( const Node &other ){
	m_label = other.label();
	m_id = other.identifier();
}

QString Node::label()const{
	return m_label;
}

bool Node::operator==( const Node &other )const{
	return identifier() == other.identifier();
}

int Node::identifier()const{
	return m_id;
}

void Node::operator=( const Node &other ){
	m_label = other.label();
	m_id = other.identifier();
}

QString Node::_toDOT()const{
	if( m_label.isEmpty() )
		return QString().setNum( m_id ) + QString(";");
	else
		return QString().setNum( m_id ) + QString("[label=") + m_label + QString("];");
}

QString Node::toString()const{
	return QString("Node(").append(QString().setNum(m_id)).append( m_label.isEmpty()? "" : QString(", ").append(m_label) ).append(")");
	return QString("Node(").append( m_label.isEmpty()?QString().setNum(m_id):m_label ).append(")");
}
